; The comment character in AutoIt is ;
Local $inTargetProg = False
Opt("WinTitleMatchMode", 2)

Func showNextFile()
    Send("j")
    sleep(500)
	Send("g")
    sleep(100)
	Send("o")
EndFunc

While 1
    If WinActive("- GVIM") and Not $inTargetProg Then
    	HotKeySet("{RIGHT}", "showNextFile") ; binds Alt+Q to the _num7() function
    	$inTargetProg = True
    EndIf

    If Not WinActive("- GVIM") and $inTargetProg Then
    	HotKeySet("{RIGHT}") ; UnBind the hotkey when not in use
    	$inTargetProg = False
    EndIf

    sleep(100)
WEnd